<?php
/**
 * <https://y.st./>
 * Copyright © 2018 Alex Yst <mailto:copyright@y.st>
 * 
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 * 
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with this program. If not, see <https://www.gnu.org./licenses/>.
**/

$xhtml = array(
	'<{title}>' => 'Time to work on palettes',
	'takedown' => '2017-11-01',
	'<{body}>' => <<<END
<img src="/img/CC_BY-SA_4.0/y.st./weblog/2018/07/25.jpg" alt="A large bird, perhaps a vulture, sitting on a roof" class="framed-centred-image" width="649" height="480"/>
<section id="Minetest">
	<h2>Minetet</h2>
	<p>
		I ran into a multitude of difficulties in upgrading <code>minestats</code>.
		It took hours to debug all the problems I&apos;d introduced.
		Everything&apos;s great now though.
		At this point, I couldn&apos;t ask for <code>minestats</code> to be better.
		I still have lingering questions about how to store the data, but these are questions I&apos;ve had for a great while now.
		Specifically, I&apos;ve been wondering if I need to merge multiple stacks obtained in a single drop into a single stat.
		I&apos;ve got mixed feelings about this.
		I guess signs mostly point to no, I shouldn&apos;t.
		For starters, this would introduce the concept of variable-width drops.
		Right now, each counted drop is one stack in width.
		If the width was variable though, I&apos;d have no excuse not to count zero-width drops.
		This is mostly problematic because of code written into Minetest Game to deal with a bug in the engine&apos;s built-in scripts.
		I found and squashed that bug, but not before an empty drop was added to nodes that shouldn&apos;t be diggable, such as water, lava, and air.
		Also, we have fire.
		I think fire still goes out when you punch it, so you can never mine it, but it still has an empty drop just in case.
		And even if you could dig it, should I have <code>minestats</code> record the number of fires you put out, encouraging people to light and extinguish fires?
		I came up with another reason not to do it too, but as I was writing down this first issue I keep coming back to, I forgot the new issue.
	</p>
	<p>
		I guess now it&apos;s time to work on the <code>palette</code> mod.
		However, I&apos;ve decided to mangle my perfect 256-colour palette.
		All the colours are arranged in a way that makes sense mathematically, allowing the precise colour you want to use to be calculated.
		However ... there&apos;s the issue of drops.
		There are three palette sizes, one for each of the different <code>paramtype2</code> values involving colour.
		If a node that uses a smaller palette drops an item that uses a bigger pallet and the <code>inherit_color</code> flag is used, the dropped item will inherit the wrong colour because the palettes don&apos;t line up.
		For that reason, I need to rearrange the colours in the 256-colour palette so the colours of the 32-colour palette take up the first 32 slots.
		Likewise, I need to rearrange the 32-colour palette so the first eight colours match that of the 8-colour palette.
		There are two main challenges posed by this.
		First and foremost, I don&apos;t really have the 32-colour palette decided upon yet.
		I think I did as well as I possibly could for the 256-colour palette and with the 8-colour palette, there was only really one logical choice as to which eight colours to use.
		The 32-colour palette is a pain though, and making the colours both reasonable and something I can find alternatives for in the larger palette will be a chore.
		Second, once the palettes are complete, I&apos;ll need to write code to essentially unscramble the palette for colour mixing, then re-scramble for choosing the correct <code>palette_index</code> value.
	</p>
	<p>
		I guess if I&apos;m honest with myself, there&apos;s only one thing I can reasonably do with the mid-sized palette.
		The biggest well-spread palette scheme I can fit into a 32-colour colour space would give each of the three colour channels one of three possible values.
		This&apos;ll leave me with five extra colours I don&apos;t know what to do with.
		The large palette has six greyscale colours, and this mid-sized palette has three before the application of the five extra colours.
		I can&apos;t use these extra colours as greys, because that&apos;d give the mid-sized palette a total of eight greyscale colours.
		I wouldn&apos;t be able to find enough alternatives in the larger palette for the overlap.
		Without resorting to the addition of greyscale colours, the next option would be to add another layer to one or more colour channels, but there aren&apos;t enough colour slots remaining for that.
		My last reasonable option is to spread the extra colours symmetrically.
		The three colour channels basically make up axes in a cubic space.
		To place things symmetrically, I&apos;d need my number of extra colours to be a multiple of six (to place points in relation to the faces of the cube), eight (to place them in relation to the corners), or twelve (to place them in relation to the edges).
		No matter how I spin it, I need an even number.
		I need to take more points, but I every point corresponds to another on the other side.
		That is, except for one: completely medium grey.
		I need to remove mid-tone grey (the only grey provided by the basic 3<sup>3</sup> structure) bringing my extra colour point count up to six, then place six semi-colourised greys in which one of the three colour channels is set a bit higher or lower, but two remain at a medium setting.
		I don&apos;t like this setup.
		It makes the colours more dense in the mid-range.
		Colour averaging will make each of the mid-range colours less likely to occur than those found in the extreme parts of the colour grid.
		I don&apos;t like this answer, but I think it might be the only mathematically-justifiable one.
		And if I&apos;m going to try proposing a universal trio of palettes, they need to be justifiable at all costs.
	</p>
	<p>
		I guess when I have time, I&apos;ll rebuild the palettes, then focus on fixing up the crafting logic to accommodate them.
		Of particular note, I&apos;ll need to alter the crafting logic to intervene even when no special flag is set.
		I&apos;m using a special flag for now which determines whether the resulting item takes on the palette index of the parent items, but the <code>stairs</code> $a[API] doesn&apos;t allow for that when crafting stairs and slabs.
		<del>Of course, I plan on redoing the $a[API] a bit, but I plan for it to remain backwards compatible, unlike the palette system.</del>
		My <code>palette</code> mod will be pretty featureful.
		<del>My fork of the <code>stairs</code> mod will just be to clean up the mess the developers made there by mucking up the namespace usage.</del>
		Actually, scratch that.
		I just came up with and tested a loophole that, while it doesn&apos;t allow proper usage of namespaces, does allow me to inject pseudo-namespaces into the all-absorbing <code>stairs</code> namespace.
		It&apos;s not good, but it&apos;s good enough.
		Fixing the colour-based dying logic is now necessary not because I don&apos;t want to add new logic to the <code>stairs</code> $a[API] in my fork, but because I won&apos;t be forking <code>stairs</code> at all.
	</p>
</section>
<section id="drudgery">
	<h2>Drudgery</h2>
	<p>
		My discussion posts for the day:
	</p>
	<blockquote>
		<p>
			That certainly is an interesting concept.
			I think the real mystery is how Benjamin Button could&apos;ve been born to begin with.
			If he emerged as a fully-grown man from his mother&apos;s womb, how did he fit in the womb to begin with?
			Like you said, the end is also a mystery.
			Would he de-age beyond the stage of infancy and dye due to not having the necessary capacity to survive without being fed through an umbilical cord?
			The author could&apos;ve taken that in a number of ways, so you have to read to find out how Benjamin&apos;s life ended.
		</p>
	</blockquote>
	<blockquote>
		<p>
			The basic view of Kantian logic is that yes, stealing cannot be universalised and thus must be immoral.
			However, the reading material presented a more complex and complete view on Kantian ethics as well.
			Stealing in general cannot be universalised, but stealing in a given situation could.
			For example, if everyone stole food when they were starving and would otherwise die, but otherwise didn&apos;t steal, we&apos;d have a universalisable imperative that we could follow.
			Logically too, can you fault someone for stealing to save their own life?
			I think most people would agree such a situation would warrant and justify the theft.
		</p>
		<p>
			As for piracy, it isn&apos;t theft.
			When you steal something, the person you stole it from no longer has it.
			When you pirate, the original &quot;owner&quot; of the work still has it.
			You just have it too.
			Piracy is simply copying.
			Many people claim piracy is stealing money, but again, you didn&apos;t steal any money either.
			Money is a physical object, but you can&apos;t steal what someone doesn&apos;t have.
			You certainly didn&apos;t pay for the media, but since the &quot;owner&quot; never had you money, you couldn&apos;t have stolen that money from them.
			They had just the same amount of money before as after you pirated the file.
			Piracy isn&apos;t immoral, because it&apos;s not theft in any way, shape, or form.
			Besides, ideas simply cannot be owned.
			Only physical objects can be owned, and only physical objects can be stolen.
			The media companies just want you to believe otherwise because it makes them more money if you think by not paying, you&apos;d be &quot;stealing&quot;.
			It&apos;s a lie though.
			A deception.
			A ruse.
			Piracy may be illegal, but that doesn&apos;t make it morally wrong.
			Just like how Finn not turning in Jim was illegal, but that didn&apos;t make it morally wrong not to turn him in.
		</p>
	</blockquote>
	<blockquote>
		<p>
			You make a good point about Kant attempting to objectively define morality.
			Personally, I think objective morality is an impossibility.
			Everyone has their own moral framework, and without people alive to define morals, morality simply would not exist.
			Morality is a purely-human construct.
			That said, I think Kant comes the closest to defining an objective moral framework that I&apos;ve ever seen.
			It&apos;s logical.
			It&apos;s calculated.
			It&apos;s almost scientific.
		</p>
	</blockquote>
</section>
END
);
